import { Controller } from 'egg';

export default class ActiveController extends Controller {

  public async all() {
    const { ctx, service } = this;
    ctx.body = await service.active.all();
  }

  public async share() {
    const { ctx, service } = this;
    const validate = {
      userId: 'int',
      time: 'int',
      text: 'string',
      photos: {
        type: 'array',
        itemType: 'string',
      },
    };
    ctx.validate(validate);
    ctx.body = await service.active.share(ctx.request.body);
  }
}
